fix: resolve Memory Summary showing no data in Hardware Information (…#821
fix: resolve Memory Summary showing no data in Hardware Information (…#821amarnath-ac wants to merge 3 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #821 +/- ##
=======================================
Coverage 39.76% 39.76%
=======================================
Files 114 114
Lines 10768 10768
=======================================
Hits 4282 4282
Misses 6087 6087
Partials 399 399 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@amarnath-ac Since we know the type of data which is []physical.PhysicalMemory, it's not necessary to use reflect. Reflect is generally used when the type is truly unknown at compile time. Instead, convert the typed slice to []interface{} at the source (in createMapInterfaceForHWInfo), which is consistent with how the other CIM types are handled. This way parseCIMResponse doesn't need to change at all. internal\usecase\devices\wsman\message.go: line number 534
Add the following function to the same file I have tested this fix on AMT 19 and Memory Summary loads correctly. Please verify on your end as well. |
There was a problem hiding this comment.
Pull request overview
Fixes the Hardware Information “Memory Summary shows no data” regression by making parseCIMResponse correctly handle responses values that come back as typed slices (e.g., []physical.PhysicalMemory) rather than only []interface{}.
Changes:
- Update
parseCIMResponseto convert typed slices ininfo["responses"]into[]interface{}via reflection. - Add a focused private-unit test suite for
parseCIMResponse, covering nil/invalid inputs and multipleresponses/statusshapes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
internal/usecase/devices/info.go |
Converts typed-slice responses values to []interface{} so memory items populate correctly. |
internal/usecase/devices/info_private_test.go |
Adds comprehensive unit tests for parseCIMResponse covering typed slice handling and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Thanks for feedback, will update as suggested. |
@madhavilosetty-intel , Updated code |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…816) Enhanced parseCIMResponse to handle typed slices using reflection. Added test for parseCIMResponse function achieving 100% coverage. Signed-off-by: C, Amarnath <amarnath.c@intel.com> Signed-off-by: S, Devipriya <devipriya.s@intel.com>
Convert PhysicalMemory slice to interface slice at source.
3c0a659 to
8eb3095
Compare
Address PR review feedback to use more specific function naming that reflects its single-purpose for PhysicalMemory type conversion.
rsdmike
left a comment
There was a problem hiding this comment.
Hey @amarnath-ac , generallly this is the simplicity we are looking for:
"responses": hwResults.PhysicalMemoryResult.Body.PullResponse.MemoryItems, , if its not useful from go-wsman-messages, then that is really where the change should be, can you take a look at fixing at the root of the problem instead of trying to convert something on top of the original conversion.
Sure, I will analyze and fix it. |
…#816)
Enhanced createMapInterfaceForHWInfo function to handle physical memory slice.
Added test for convertPhysicalMemorySlice function achieving 100% coverage.